﻿Imports System.Diagnostics
Imports System.Windows.Forms

Public Class MainForm

#Region "Global Controls"
    ''' <summary>Create instances of the UserControls in the dbiWSF.ControlLibrary and user controls in the demo project
    ''' that will be used for the UI of the demo.  NOTE:  This is because the controls were not dragged from the toolbar onto the form.
    ''' NOTE: The instances are created "WithEvents" to allow for the custom coding of interraction with the controls.
    ''' (See control routines below)</summary>

    Dim WithEvents dbiWSFSchedule1 As New dbiWSF.ControlLibrary.dbiWSFSchedule
    Dim WithEvents dbiWSFDayView1 As New dbiWSF.ControlLibrary.dbiWSFDayView
    Dim WithEvents dbiReportObject1 As New dbiWSF.ControlLibrary.dbiWSFReport

    Dim WithEvents SchedDetail As New ScheduleFormDetails
    Dim WithEvents DayViewDetail As New DayViewFormDetails
    Dim WithEvents ExceptionMaintenance As New ExceptionMaintenanceControl
    Dim WithEvents ExceptionDetail As New ExceptionFormDetails

    'NOTE: The Welcome Screen hosts a WPF User Control therefore it is an instance of the ElementHost control.
    '      The WSSHomeUC is placed in the MyWelcomeScreen.
    Dim WithEvents MyWelcomeScreen As New System.Windows.Forms.Integration.ElementHost

#End Region
    
#Region "Global Variables"
    ''' <summary>Global Variables for the life of the application.</summary>

    Dim StartDate As Date = CDate("Jan-2,2012")     'Create and set global dates to ensure the demo is synched with the database.

    Dim EndDate As Date = CDate("Jan-7,2012")       'Create and set global dates to ensure the demo is synched with the database.

    Dim wasDropped As Boolean = False   'Global variable for tracking a dropped event.
    Dim DroppedShipmentType As String = ""  'Global variable for tracking a dropped event.

#End Region
    
#Region "Form routines"
    ''' <summary>The routines that govern the loading and split control user interraction.</summary>

    Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim Login As New LoginForm

        'Prompt the user to log in to the application.
        Login.ShowDialog()

        If Login.DialogResult = Windows.Forms.DialogResult.OK Then
            Windows.Forms.Cursor.Current = Cursors.WaitCursor
            My.Application.SaveMySettingsOnExit = True

            'Check the login level, to determine what options and functionality are available
            If LoginLevel > LoginCredentials.User Then
                Me.ToolStripDropDownAdmin.Enabled = True
                Me.ToolStripDropDownAdmin.ToolTipText = "Administrator Tools"
                If LoginLevel > LoginCredentials.Manager Then
                    Me.ToolStripDropDownCodeSample.Enabled = True
                End If
            Else
                Me.ToolStripDropDownAdmin.ToolTipText = "Manager login or higher required"
            End If

            'Load all the data and create all the dbiWSF objects based on that data.
            'NOTE:  This initiates the WSFObjects and populates the object collections with the
            'records from the WSF database but not the additional Purchase Orders/Sales Orders data.
            myWSFObjects.LoadAllData()

            'Set up the UI
            Me.dbiWSFSchedule1.TipsOnTimebarOver = True
            Me.dbiWSFSchedule1.TipsOnTitleOver = True
            Me.dbiWSFDayView1.TipsOnAppointmentOver = True
            Me.dbiWSFSchedule1.OutboundShipmentColor = Color.LightGray
            Me.dbiWSFSchedule1.dbiScheduleMain.AllowDrop = True
            Me.dbiWSFDayView1.BackColor = Color.LightSteelBlue

            'Populate the drop down list with the available style types
            Me.ToolStripComboBoxStyler.Items.Add("Blue")
            Me.ToolStripComboBoxStyler.Items.Add("Gold")
            Me.ToolStripComboBoxStyler.Items.Add("Green")
            Me.ToolStripComboBoxStyler.Items.Add("MintChocolate")
            Me.ToolStripComboBoxStyler.Items.Add("Orange")
            Me.ToolStripComboBoxStyler.Items.Add("Purple")
            Me.ToolStripComboBoxStyler.Items.Add("Red")
            Me.ToolStripComboBoxStyler.Items.Add("WPF")
            Me.ToolStripComboBoxStyler.Items.Add("CPITF")
            Me.ToolStripComboBoxStyler.Text = curStyleName

            'Set the WSFObject and BusinessRules to be used with the context menu
            myContextMenu.WSFObjects = myWSFObjects
            myContextMenu.MyBusinessRules = myBusinessRules

            'Open up the Home Page in the demo at startup.
            Me.DbiExplorerListMain.State = Dbi.WinControl.ExplorerBar.dbiExplorerList.enumState.Opened
            Dim args As New Dbi.WinControl.ExplorerBar.ItemClickEventArgs
            args.ItemIndex = 0
            args.ListIndex = 0
            'Call the dbiExplorerBar ItemClick event with the Home Page Selection
            Me.DbiExplorerBar1_ItemClick(Me.DbiExplorerBar1, args)

            'Load the Purchase Orders, Sales Orders, Shippers from the corporate database.
            'NOTE: These routines are coded in the modMain.vb module.
            LoadOrders()
            LoadProductsFromNorthwind()
            LoadShippers()

            Windows.Forms.Cursor.Current = Cursors.Default

        Else

            Me.Close()

        End If

    End Sub

    Private Sub AlignWelcomescreen()
        'This method adjusts the welcome screen WPF user control that presents the Home Page, to fit in the center of the available space.
        Dim curLeft As Integer
        Dim curTop As Integer

        curLeft = CInt((Me.SplitContainer.Panel2.Width - MyWelcomeScreen.Width) / 2)
        curTop = CInt((Me.SplitContainer.Panel2.Height - MyWelcomeScreen.Height) / 2)
        MyWelcomeScreen.Location = New Point(curLeft, curTop)

    End Sub

    Private Sub SplitContainer_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles SplitContainer.Resize
        'Readjust the objects in the split container.
        Me.SplitContainer.SplitterDistance = 217
        AlignWelcomescreen()
        AdjustSchedView()

    End Sub

#End Region

#Region "Schedule routines"
    ''' <summary>The routines that govern the interraction with the dbiSchedule multi-resource scheduling control.</summary>
    Private Sub ComboBoxDayViewWarehouse_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxDayViewWarehouse.SelectedIndexChanged
        'This event is fired when the user selects a warehouse from the warehouses combo box in the dbiWSFDayView user control.

        If Me.ComboBoxDayViewWarehouse.SelectedIndex > 0 Then

            'If a Warehouse has been selected then reset the LoadingDock Combo Box to its default value.
            Me.ComboBoxDayViewLoadingDock.SelectedIndex = 0

            'Set the Title of the day view control to the text of the selected warehouse in the combo box.
            Me.dbiWSFDayView1.TitleText = Me.ComboBoxDayViewWarehouse.Text

        End If

        'Call the custom SetdbiDayViewSettings routine below to populate the control based on the new warehouse setting.
        SetdbiDayViewSettings()

    End Sub

    Private Sub ComboBoxDayViewLoadingDock_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxDayViewLoadingDock.SelectedIndexChanged
        'This event is fired when the user selects a Loading Dock from the Loading Docks combo box in the dbiWSFDayView user control.

        If Me.ComboBoxDayViewLoadingDock.SelectedIndex > 0 Then

            'If a LoadingDock has been selected reset the Warehouse and CargoType Combo Boxes to their default values.
            Me.ComboBoxDayViewWarehouse.SelectedIndex = 0
            Me.ComboBoxDayViewCargoTypeFilter.SelectedIndex = 0

            'Set the title of the day view control to the text of the loading dock selected.
            Me.dbiWSFDayView1.TitleText = Me.ComboBoxDayViewLoadingDock.Text

        End If

        'Call the custom SetdbiDayViewSettings routine below to populate the control based on the new loading dock setting.
        SetdbiDayViewSettings()

    End Sub

    Private Sub ComboBoxDayViewCargoTypeFilter_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxDayViewCargoTypeFilter.SelectedIndexChanged
        'This event is fired when the user selects a Cargo Type from the Cargo Types combo box in the dbiWSFDayView user control.

        If Me.ComboBoxDayViewCargoTypeFilter.SelectedIndex > 0 Then

            'If a CargoType has been selected then reset the LoadingDock Combo Box to its default value
            Me.ComboBoxDayViewLoadingDock.SelectedIndex = 0

            'Create a new Image object based on the value stored with the CargoType in the database.
            Dim myBitmap As New Bitmap(24, 22)
            Dim myGraphics As Graphics = Graphics.FromImage(myBitmap)

            'NOTE: The cargo type object has an icon property that serves as the base image for the type of cargo being represented.
            '      This is used as the base image for presentation in the cargo type filter label.
            Dim curCargo As dbiWSF.FrameworkObjects.objCargoType = myWSFObjects.CargoTypes(Me.ComboBoxDayViewCargoTypeFilter.Text)
            Dim curByte() As Byte = curCargo.Icon
            Dim curImage As Image = Image.FromStream(New System.IO.MemoryStream(curByte))
            myGraphics.DrawImage(curImage, 0, 0, 24, 22)

            'Apply the image to the dbiLabel located in the dbiWSFDayView user control.
            'This image indicates the current CargoType filter applied to the Warehouse view of the control.
            Me.dbiWSFDayView1.DbiLabel1.Image = myBitmap
            Me.dbiWSFDayView1.DbiLabel1.ImageAlign = ContentAlignment.BottomCenter
            Me.dbiWSFDayView1.DbiLabel1.MaskColor = Color.White

        Else

            'If no CargoType is selected clear the image from the dbiLabel
            Me.dbiWSFDayView1.DbiLabel1.Image = Nothing

        End If

        'Call the custom SetdbiDayViewSettings routine below to populate the control based on the new cargo type setting.
        SetdbiDayViewSettings()

    End Sub

    Private Sub dbiSchedule1_clBeforeTimeBarDrop(ByVal sender As Object, ByVal e As Dbi.WinControl.Schedule.BeforeTimeBarDropEventArgs) Handles dbiWSFSchedule1.clBeforeTimeBarDrop
        'This event is raised when a shipment is dropped in the schedule area of the dbiWSFSchedule1 control.
        'NOTE: In the schedule control shipments are represented as time bars in an item (Loading Dock).
        '      This event does not fire when an object is dropped on any other part of the dbiSchedule control.

        'Test to make sure the drag came from a valid source. If so, the adjust the drop
        'to reflect the type of drop taking place. 

        Dim objItem As Object
        Dim strText As String

        objItem = e.drgevent.Data.GetData(DataFormats.Text) 'Store the data being dragged in an object
        strText = objItem.ToString()

        'Set the shipment to require 1 hour of dock time.
        'NOTE: The e argument contains the time bar (shipment) being created as the result of the drop event with a start time 
        '      equal to the time on which the drop took place. Set the end time to be 60 minutes after the start time.

        e.TimeBarItem.End = e.TimeBarItem.Start.AddMinutes(60)

        'Create a new shipment object to attach to the time bar.
        'NOTE: The e argument also contains the loading dock on which the drop occurred.
        Dim newShipment As New dbiWSF.FrameworkObjects.objShipment(myWSFObjects)
        newShipment.ShipmentID = System.Guid.NewGuid
        newShipment.SchedStartTime = e.TimeBarItem.Start
        newShipment.SchedEndTime = e.TimeBarItem.Start.AddMinutes(60)
        newShipment.LoadingDockID = e.ScheduleItem.Tag.LoadingDockID
        e.TimeBarItem.Tag = newShipment
        DroppedShipmentType = strText

        Select Case strText

            Case "Inbound"
                e.AllowDrop = True  'Allow the drop to continue.  This will allow the code in the base class to invoke the databinding code in accordance with the settings on the WSFObject.
                wasDropped = True
                newShipment.ShipmentType = dbiWSF.FrameworkObjects.ShipmentTypes.Inbound
                'Add the shipment to the collection of shipments on the loading dock (the item in the schedule).
                newShipment.AddNew(e.ScheduleItem.Tag)

                'Test the shipment to see if it conforms to the business rules.
                'NOTE: The dlgBusinessRule can be found in the dbiWSF Dialogs in the user interface library.
                Dim dlgBusiness As New dbiWSF.Dialogs.dlgBusinessRule(myBusinessRules)
                dlgBusiness.StartProcessSynch(newShipment, dbiWSF.BusinessRulesAndSupport.BusinessRuleObjects.RequestAction.Add)
                e.AllowDrop = dlgBusiness.DialogResult

                If dlgBusiness.DialogResult = Windows.Forms.DialogResult.Cancel Then
                    'Cancel the drop
                    e.AllowDrop = False
                    'Remove the shipment from the loading dock's collection of shipments.
                    newShipment.Remove(e.ScheduleItem.Tag)
                End If

            Case "Outbound"
                e.AllowDrop = True  'Allow the drop to continue.  This will allow the code in the base class to invoke the databinding code in accordance with the settings on the WSFObject.
                wasDropped = True
                newShipment.ShipmentType = dbiWSF.FrameworkObjects.ShipmentTypes.Outbound
                'Add the shipment to the collection of shipments on the loading dock (the item in the schedule).
                newShipment.AddNew(e.ScheduleItem.Tag)

                'Test the shipment to see if it conforms to the business rules.
                'NOTE: The dlgBusinessRule can be found in the dbiWSF Dialogs in the user interface library.
                Dim dlgBusiness As New dbiWSF.Dialogs.dlgBusinessRule(myBusinessRules)
                dlgBusiness.StartProcessSynch(newShipment, dbiWSF.BusinessRulesAndSupport.BusinessRuleObjects.RequestAction.Add)

                If dlgBusiness.DialogResult = Windows.Forms.DialogResult.Cancel Then

                    'Cancel the drop.
                    e.AllowDrop = False
                    'Remove the shipment from the loading dock's collection of shipments.
                    newShipment.Remove(e.ScheduleItem.Tag)
                End If

            Case Else
                e.AllowDrop = False 'Prevent the drop from taking place

        End Select

        If e.AllowDrop Then
            'Prompt the user to supply the details (Purchase Orders or Sales Orders) for the shipment
            Dim shipmentInfo As New ShipmentDetails(newShipment)
            shipmentInfo.ShowDialog(Me)
            shipmentInfo.Dispose()
        End If

        'Synchronize the Schedule control with the data objecst in the dbiWSF object.
        Me.dbiWSFSchedule1.DataRefresh()

    End Sub

    Private Sub dbiSchedule1_clShipmentAfterAdd(ByVal sender As Object, ByVal e As dbiWSF.ControlLibrary.dbiWSFSchedule.ScheduleArgs) Handles dbiWSFSchedule1.clShipmentAfterAdd
        'This event is fired after a time bar (shipment) is added to the multi-resource schedule control by clicking and dragging inside the schedule area.
        'Prompt the user to supply the details (Purchase Orders or Sales Orders) for the shipment.
        Dim newFrm As New ShipmentDetails(e.argShipment)
        newFrm.ShowDialog(Me)

        If newFrm.DialogResult = DialogResult.Cancel Then
            'Remove the shipment from the loading dock's collection of shipments.
            e.argShipment.Remove(e.argLoadingDock)

        End If

        'Synchronize the Schedule control with the data objecst in the dbiWSF object.
        Me.dbiWSFSchedule1.DataRefresh()

    End Sub

    Private Sub dbiSchedule1_clShipmentDoubleClick(ByVal sender As Object, ByVal e As dbiWSF.ControlLibrary.dbiWSFSchedule.ScheduleArgs) Handles dbiWSFSchedule1.clShipmentDoubleClick
        'This event is fired when a time bar (shipment) receives a double click event.
        'Present the user with the details of the shipment (Purchase Orders or Sales Orders)
        Dim frmShipDetails As New ShipmentDetails(e.argShipment)
        frmShipDetails.ShowDialog(Me)

        'Synchronize the Schedule control with the data objecst in the dbiWSF object.
        Me.dbiWSFSchedule1.DataRefresh()

    End Sub

    Private Sub RadioButtonDays_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButtonDays1.CheckedChanged, RadioButtonDays5.CheckedChanged, RadioButtonDays7.CheckedChanged

        If sender.checked Then

            'This will adjust the dbiWSFSchedule user control to display the selected amount of days from the selected StartDate.
            'NOTE: The value is determined by the text of the radio button that triggers the event.
            'The available values in this demo are 1 day, 5 days, and 7 days

            If dbiWSFSchedule1.dbiScheduleMain.Schedules.Count > 0 Then

                Dim curDate As Date
                'Set the schedule control display to start at midnight on the selected day.
                curDate = Me.DbiDateTimeSchedStart.Date

                'Load the schedule control with the Warehouse, Loading Docks, Shipments, and Exceptions for the selected period.
                dbiWSFSchedule1.SetMainObjects(myWSFObjects, myBusinessRules, curDate, curDate.AddDays(sender.text))

            End If

            'Set the schedule control to display 1,5, or 7 days.
            SetSchedView(CLng(sender.text))

        End If

    End Sub

    Private Sub DbiDateTimeSchedStart_DateChanged(ByVal sender As Object, ByVal e As System.EventArgs)

        'Calculate and store the current difference between the start and end of the schedule (start and end dates).
        'This is to insure the same amount of days are visible in the schedule when a new start date for the schedule is set.
        Dim curDateDiff As Long

        curDateDiff = DateDiff(DateInterval.Day, Me.dbiWSFSchedule1.dbiScheduleMain.Schedules(0).Start, Me.dbiWSFSchedule1.dbiScheduleMain.Schedules(0).End)
        Me.dbiWSFSchedule1.dbiScheduleMain.Schedules(0).Start = Me.DbiDateTimeSchedStart.Date
        Me.dbiWSFSchedule1.dbiScheduleMain.Schedules(0).End = Me.DbiDateTimeSchedStart.Date.AddDays(curDateDiff)

        'Scroll the control to the relative time based off the previous position in the schedule and its new start date
        Me.dbiWSFSchedule1.dbiScheduleMain.ScrollToDateTime(Me.DbiDateTimeSchedStart.Date.AddHours(Me.dbiWSFSchedule1.dbiScheduleMain.SchedScrollValue), 0)

        'Repopulate the schedule, based on its new values
        dbiWSFSchedule1.SetMainObjects(myWSFObjects, myBusinessRules, Me.dbiWSFSchedule1.dbiScheduleMain.Schedules(0).Start, Me.dbiWSFSchedule1.dbiScheduleMain.Schedules(0).End)

        'Set the schedule control to display 1,5, or 7 days.
        SetSchedView(curDateDiff)

    End Sub

    Private Sub UpdateSchedDetail()
        'This method is used to keep the dbiLabels on the ScheduleDetail user control in synch with the current style
        'and settings of the displayed dbiWSFSchedule
        Me.SchedDetail.DbiLabelInbound.BackColor = Me.dbiWSFSchedule1.dbiScheduleMain.TimeBarBackColor
        Me.SchedDetail.DbiLabelInbound.BackColorTo = Me.dbiWSFSchedule1.dbiScheduleMain.TimeBarBackColorTo
        Me.SchedDetail.DbiLabelInbound.BorderType = Me.dbiWSFSchedule1.dbiScheduleMain.TimeBarBorderType
        Me.SchedDetail.DbiLabelInbound.BorderColor = Me.dbiWSFSchedule1.dbiScheduleMain.TimeBarBorderColor
        Me.SchedDetail.DbiLabelInbound.FillType = Me.dbiWSFSchedule1.dbiScheduleMain.TimeBarFillType
        Me.SchedDetail.DbiLabelInbound.ForeColor = Me.dbiWSFSchedule1.dbiScheduleMain.TimeBarForeColor

        Me.SchedDetail.DbiLabelOutbound.BackColor = Me.dbiWSFSchedule1.dbiScheduleMain.TimeBarBackColor
        Me.SchedDetail.DbiLabelOutbound.BackColorTo = Me.dbiWSFSchedule1.OutboundShipmentColor
        Me.SchedDetail.DbiLabelOutbound.BorderType = Me.dbiWSFSchedule1.dbiScheduleMain.TimeBarBorderType
        Me.SchedDetail.DbiLabelOutbound.BorderColor = Me.dbiWSFSchedule1.dbiScheduleMain.TimeBarBorderColor
        Me.SchedDetail.DbiLabelOutbound.FillType = Me.dbiWSFSchedule1.dbiScheduleMain.TimeBarFillType
        Me.SchedDetail.DbiLabelOutbound.ForeColor = Me.dbiWSFSchedule1.dbiScheduleMain.TimeBarForeColor


        Me.SchedDetail.DbiLabelDockException.BackColor = Me.dbiWSFSchedule1.ExceptionColor
        Me.SchedDetail.DbiLabelRecurringDockException.BackColor = Me.dbiWSFSchedule1.RecurrenceDailyColor

    End Sub

    Private Sub SetSchedView(ByVal DateRange As Long)
        'Set the schedule control to display date range from the settings in the control.
        'NOTE: For the purpose of this demo the allowable range is 1, 5, or 7 days
        Select Case DateRange
            Case 1
                Me.dbiWSFSchedule1.SetScheduleView(dbiWSF.ControlLibrary.dbiWSFSchedule.ScheduleViews.Daily15MinHourlyView, Me.DbiDateTimeSchedStart.Date, Me.DbiDateTimeSchedStart.Date.AddDays(1), False)
                Me.dbiWSFSchedule1.dbiScheduleMain.Enabled = True
                'Scroll the schedule to start displaying at 8:00 am
                Me.dbiWSFSchedule1.dbiScheduleMain.ScrollToDateTime(Me.DbiDateTimeSchedStart.Date.AddHours(8), 0)

            Case 5
                Me.dbiWSFSchedule1.SetScheduleView(dbiWSF.ControlLibrary.dbiWSFSchedule.ScheduleViews.Weekly1DayWeeklyView, Me.DbiDateTimeSchedStart.Date, Me.DbiDateTimeSchedStart.Date.AddDays(5), True)
                'Calculate the optimum distance between major increments in the ruler area given the size of the schedule control.
                'NOTE: This maximizes the real estate available to the scheduling area in the control relative to screen resolution and size of the form.
                Dim TimeWidth As Long = Me.dbiWSFSchedule1.dbiScheduleMain.Width - Me.dbiWSFSchedule1.dbiScheduleMain.ListWidth - Me.dbiWSFSchedule1.dbiScheduleMain.SplitterBarWidth - 3 - 15
                Dim TimeDistance As Long
                TimeDistance = Int(Int(TimeWidth / 5)) - Int(Int(TimeWidth / 5)) Mod 2 ' Highest common denominator

                'Make sure the time distance calculated is divisible by 2 with no remainder, if not default to next smallest value.
                If Int((TimeDistance / 2) / 2) <> (TimeDistance / 2) / 2 Then

                    TimeDistance = TimeDistance - 2

                End If

                'Set the schedule to display in days
                Me.dbiWSFSchedule1.dbiScheduleMain.Schedules(0).TimeType = Dbi.WinControl.Schedule.enumTimeType.Days
                'Set the distance between major time increments (days) to the calculated optimum value
                Me.dbiWSFSchedule1.dbiScheduleMain.TimeDistance = TimeDistance
                'Set the schedule to display divisions at every 2 hours.
                Me.dbiWSFSchedule1.dbiScheduleMain.Schedules(0).RulerDivisions = 12
                'Disable the schedule control when in this view as the minimum time bar (shipment) is two hours.
                'The schedule in this view is read only.
                Me.dbiWSFSchedule1.dbiScheduleMain.Enabled = False

            Case 7
                'Set the schedule control to display weeks
                Me.dbiWSFSchedule1.SetScheduleView(dbiWSF.ControlLibrary.dbiWSFSchedule.ScheduleViews.Weekly1DayWeeklyView, Me.DbiDateTimeSchedStart.Date, Me.DbiDateTimeSchedStart.Date.AddDays(7), True)
                'Disable the schedule control when in this view as the minimum time bar (shipment) is well over one hour.
                'The schedule in this view is read only.
                Me.dbiWSFSchedule1.dbiScheduleMain.Enabled = False

        End Select

    End Sub

    Private Sub AdjustSchedView()
        'Ensures the schedule view is recalculated for maximum display (used during resizes)
        Dim args As New System.EventArgs

        Select Case True
            Case Me.RadioButtonDays1.Checked
                Me.RadioButtonDays_CheckedChanged(Me.RadioButtonDays1, args)
            Case Me.RadioButtonDays5.Checked
                Me.RadioButtonDays_CheckedChanged(Me.RadioButtonDays5, args)
            Case Me.RadioButtonDays7.Checked
                Me.RadioButtonDays_CheckedChanged(Me.RadioButtonDays7, args)
        End Select
    End Sub

    Private Sub LinkLabelSchedProps_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabelSchedProps.LinkClicked
        'Display a PropertyGrid object to present and allow the user to interract with the property settings of the schedule control.
        Dim propFrm As New PropertyForm
        propFrm.PropertyGrid1.SelectedObject = dbiWSFSchedule1
        propFrm.ShowDialog(Me)
        'Synchronize the dbiLabels in the schedule user control with the settings from the property grid.
        UpdateSchedDetail()

        propFrm.Dispose()

    End Sub

#End Region

#Region "Custom Classes"
    ''' <summary>This is a custom class used to store a String value and an Object inside of a combo box item</summary>
    Public Class cbxItem
        Public Text As String
        Public objData As Object
        Public Sub New(ByVal text As String, ByVal objData As Object)
            Me.Text = text
            Me.objData = objData
        End Sub
        Public Overrides Function ToString() As String
            Return Me.Text
        End Function
    End Class

#End Region

#Region "ToolStrip code"
    ''' <summary>The routines that govern the interraction with the toolstrip at the top of the application main form.</summary>
    Private Sub ToolStripExplorerBarDisplayButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripExplorerBarDisplayButton.Click
        'This method sets the Explorer Bar visible or invisible.

        If Me.ToolStripExplorerBarDisplayButton.Text = "Hide" Then

            'If currently visible the dbiExplorerBar will be hidden
            HideExplorerBar()

        Else

            'If hidden, the dbiExplorerBar will now be shown
            ShowExplorerBar()

        End If
        'Readjust the hosted forms in the right of the split container.
        AlignWelcomescreen()
        AdjustSchedView()

    End Sub

    Private Sub ShowExplorerBar()
        'This method displays the dbiExplorerBar on the left hand side of the application
        'and updates the properties of the display/hide ExplorerBar button in the ToolStrip appropriately.
        Me.SplitContainer.Panel1Collapsed = False
        Me.ToolStripExplorerBarDisplayButton.Image = My.Resources.Collapse
        Me.ToolStripExplorerBarDisplayButton.Text = "Hide"
        Me.ToolStripExplorerBarDisplayButton.ToolTipText = "Hide the ExplorerBar"
        Me.ToolStripExplorerBarDisplayButton.TextImageRelation = TextImageRelation.ImageBeforeText

    End Sub

    Private Sub HideExplorerBar()
        'This method hides the dbiExplorerBar on the left hand side of the application
        'and updates the properties of the display/hide button in the ToolStrip appropriately.
        Me.SplitContainer.Panel1Collapsed = True
        Me.ToolStripExplorerBarDisplayButton.Image = My.Resources.Expand
        Me.ToolStripExplorerBarDisplayButton.Text = "Show"
        Me.ToolStripExplorerBarDisplayButton.ToolTipText = "Show the ExplorerBar"
        Me.ToolStripExplorerBarDisplayButton.TextImageRelation = TextImageRelation.TextBeforeImage

    End Sub

    Private Sub ToolStripHomeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripHomeButton.Click
        'Reset the view of the application to its original Startup appearance displaying the Home Page.
        Me.WindowState = FormWindowState.Normal
        ShowExplorerBar()
        HideExplorerLists(0)
        Dim args As New Dbi.WinControl.ExplorerBar.ItemClickEventArgs
        args.ItemIndex = 0
        args.ListIndex = 0
        Me.DbiExplorerBar1_ItemClick(Me.DbiExplorerBar1, args)

    End Sub

    Private Sub ToolStripAddWarehouse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripAddWarehouse.Click
        'Create a new objWarehouse and display a detail dialogue (from the UI classes) to allow the user to modify 
        'the details of the warehouse and ultimately save it to the database.
        Dim newWarehouse As New dbiWSF.FrameworkObjects.objWarehouse(myWSFObjects)

        newWarehouse.AddNew()

        'Display the detail dialogue passing in the new warehouse object.
        'NOTE: The detail dialogue object conformas to the object passed in its ShowWithObject method.
        Dim detailDLG As New dbiWSF.Dialogs.dlgWSFObjectDetail
        detailDLG.ShowWithObject(newWarehouse, myWSFObjects, myBusinessRules)

        If detailDLG.DialogResult = Windows.Forms.DialogResult.OK Then
            'Add the new warehouse to the Warehouses Collection.
            myWSFObjects.Warehouses.Add(newWarehouse)

            'Synchronize the context menu
            myContextMenu.TriggerUpdateDataTimer()

            'Update the Warehouse Selection Combo Box in the DayView user control.
            PopulateDayViewComboBoxes()

        Else

            'Destroy the new warehouse object.
            newWarehouse.Remove()

        End If

    End Sub

    Private Sub ToolStripComboBoxStyler_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripComboBoxStyler.SelectedIndexChanged
        'NOTE: The dbiWSF also comes with a built in styler class that allows for quick and easing styling of many 
        'of dbi's .NET controls including dbiScheduleE, dbiDayView and dbiList.

        'A single instance of the styler is capable of styling multiple controls.
        Dim curStyle As New dbiWSF.ControlLibrary.dbiWSFStyleControls

        'Each control type has various options available as to what will be styled.  By default all the options will be used,
        'however the developer can set any of these options to false to prevent their styling.
        'Some examples of the options are the TimeBars and Schedule area of the dbiSchedule, the Appointments and Time Line of the dbiDayView, 
        'and the Column Headers and Title area of dbiList.
        Dim curSchedOptions As New dbiWSF.ControlLibrary.dbiStylerOptions.dbiScheduleStyleOptions
        Dim curListOptions As New dbiWSF.ControlLibrary.dbiStylerOptions.dbiListStyleOptions
        Dim curDayViewOptions As New dbiWSF.ControlLibrary.dbiStylerOptions.dbiDayViewStyleOptions

        'Retrieve the name of the style to use from a drop down list.
        curStyleName = Me.ToolStripComboBoxStyler.Text

        'Store the style in the application settings, this will allow the application to automatically use this style
        'when the user runs the application next.
        My.Settings.Style = curStyleName

        'To style a control pass the style options, the control and the styling XML you want to use.  The control will handle
        'the rest. Included in the WSF are several pre-made styling XML files stored as resources in the dbiWSFUserInterface.dll.
        'The styling XML files can be referenced programmatically by using the GetResources method of the styling class 
        '(passing the name of the style as a string), and then choosing which XML to use (ScheduleXML, DayViewXML or dbiListXML).
        curStyle.ImportXMLWithXMLString(curSchedOptions, Me.dbiWSFSchedule1.dbiScheduleMain, _
                                        dbiWSF.ControlLibrary.dbiStylerOptions.GetResources(curStyleName).ScheduleXML)
        curStyle.ImportXMLWithXMLString(curDayViewOptions, Me.dbiWSFDayView1.DbiDayView1, _
                                        dbiWSF.ControlLibrary.dbiStylerOptions.GetResources(curStyleName).DayViewXML)
        curStyle.ImportXMLWithXMLString(curListOptions, Me.ExceptionMaintenance.DbiList1, _
                                        dbiWSF.ControlLibrary.dbiStylerOptions.GetResources(curStyleName).dbiListXML)
        curStyle.ImportXMLWithXMLString(curListOptions, Me.ExceptionMaintenance.DbiList2, _
                                        dbiWSF.ControlLibrary.dbiStylerOptions.GetResources(curStyleName).dbiListXML)

        'Determines if Alternating line colors are used with the style (for displaying in the schedule).
        UseAltColors()

        'Updates the dbiLabels in the ScheduleDetail user control to have the same colors and fills as the time bars used in the schedule.
        UpdateSchedDetail()

    End Sub

    Private Sub UseAltColors()
        'Set the AlternateColor property of the dbiSchedule when dealing with any styles that require it.
        'In this application the only style that uses AlternateColors is the "WPF" style.
        Dim UseAlts As Boolean = False

        If Me.ToolStripComboBoxStyler.Text = "WPF" Then

            UseAlts = True

        End If

        Me.dbiWSFSchedule1.dbiScheduleMain.AlternateColor = UseAlts
        'Set the AlternateColor property for each schedule object contained in the dbiSchedule's Schedules Collection.
        'NOTE: The dbiSchedule control can contain more than one schedule and the Enterprise version of the control can
        '      display multiple schedule objects simultaneously.

        For Each curSched As Dbi.WinControl.Schedule.dbiScheduleObject In Me.dbiWSFSchedule1.dbiScheduleMain.Schedules

            curSched.AlternateColor = UseAlts

        Next

    End Sub

    Private Sub ToolStrip_LocationChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStrip.LocationChanged
        'Ensure the first tool strip stays in the top left corner
        If sender.location <> New Point(3, 0) Then

            sender.location = New Point(3, 0)

        End If

    End Sub

    Private Sub ToolStrip1_LocationChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ToolStrip1.LocationChanged
        'Ensure the second tool strip does not move the first tool strip from its location.

        If ToolStrip1.Location.X < 77 And ToolStrip1.Location.Y = 0 Then

            ToolStrip1.Location = New Point(77, 0)

        End If

    End Sub

#Region "Media Sample displays"
    'These methods are used to display the WSF supporting media files explaining the various aspects of the framework and its implementation.
    Private Sub ConnectingToDataToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim codeFrm As New frmCodeSample
        codeFrm.ShowSample(My.Resources.ConnectingToData, "Connecting to Data")
        codeFrm.Show(Me)

    End Sub

    Private Sub ExtendingTheContextMenuToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim codeFrm As New frmCodeSample
        codeFrm.ShowSample(My.Resources.ExtendingTheContextMenu, "Extending The Context Menu")
        codeFrm.Show(Me)
    End Sub

    Private Sub LoadingAScheduleToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim codeFrm As New frmCodeSample
        codeFrm.ShowSample(My.Resources.LoadingthedbiWSFSchedule, "Loading the dbiWSFSchedule")
        codeFrm.Show(Me)
    End Sub

    Private Sub LoadingAWarehouseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim codeFrm As New frmCodeSample
        codeFrm.ShowSample(My.Resources.DayViewDisplayWarehouse, "Displaying a Warehouse")
        codeFrm.Show(Me)
    End Sub

    Private Sub LoadingALoadingDockToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim codeFrm As New frmCodeSample
        codeFrm.ShowSample(My.Resources.DayViewDisplayLoadingDock, "Displaying a LoadingDock")
        codeFrm.Show(Me)
    End Sub

    Private Sub StylingControlsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim codeFrm As New frmCodeSample
        codeFrm.ShowSample(My.Resources.StylingControls, "Styling the Controls")
        codeFrm.Show(Me)
    End Sub

    Private Sub WPFIntegrationToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim codeFrm As New frmCodeSample
        codeFrm.ShowSample(My.Resources.DisplayingInWPF, "WPF Integration")
        codeFrm.Show(Me)
    End Sub

    Private Sub InboundAndOutboundShipmentsByCargoTypeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim codeFrm As New frmCodeSample
        codeFrm.ShowSample(My.Resources.InboundOutboundShipmentsByCargoType, "Inbound and Outbound Shipments by Cargo Type")
        codeFrm.Show(Me)
    End Sub

    Private Sub TotalInboundOrOutboundShipmentsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim codeFrm As New frmCodeSample
        codeFrm.ShowSample(My.Resources.TotalShipmentsWPF, "Total Inbound and Outbound Shipments")
        codeFrm.Show(Me)
    End Sub

    Private Sub GeneratingAReportToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim codeFrm As New frmCodeSample
        codeFrm.ShowSample(My.Resources.GeneratingAReport, "Generating a Report")
        codeFrm.Show(Me)
    End Sub

    Private Sub DisplayingAReportToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim codeFrm As New frmCodeSample
        codeFrm.ShowSample(My.Resources.DisplayingAReport, "Displaying a Report")
        codeFrm.Show(Me)
    End Sub

    Private Sub MaintainingExceptionsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim codeFrm As New frmCodeSample
        codeFrm.ShowSample(My.Resources.DisplayingExceptionDetails, "Displaying Exception Details")
        codeFrm.Show(Me)
    End Sub

    Private Sub SelectingAffectedLoadingDocksToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim codeFrm As New frmCodeSample
        codeFrm.ShowSample(My.Resources.GettingAffectedLoadingDocks, "Getting Affected Docks")
        codeFrm.Show(Me)
    End Sub
#End Region

#End Region

#Region "Dayview routines"
    ''' <summary>The routines that govern the interraction with the DayView UI Control.</summary>
    Private Sub dbiDayView1_clShipmentAfterAdd(ByVal sender As Object, ByVal e As dbiWSF.ControlLibrary.dbiWSFDayView.DayViewArgs) Handles dbiWSFDayView1.clShipmentAfterAdd
        'This event is fired after an appointment (shipment) is added to the control.

        If e.Allow Then

            e.argDbiAppointment.ReadOnly = True

            'Present the user with the Shipment Details Dialog.
            'NOTE: The new method accepts a shipment arguement in its constructor.
            Dim newFrm As New ShipmentDetails(e.argShipment)
            newFrm.ShowDialog(Me)

            If newFrm.DialogResult = DialogResult.Cancel Then

                'Remove the shipment from the loading dock's collection of shipments (represented as a column in the DayView control).
                e.argShipment.Remove(e.argLoadingDock)
                'Refresh the data to update the database.
                Me.dbiWSFDayView1.DataRefresh()

            End If

        End If

    End Sub

    Private Sub PopulateDayViewComboBoxes()
        'This method populates the three combo boxes related to the dbiWSFDayView control with the available Warehouses,
        'CargoTypes, and LoadingDocks, that have been loaded from the database.
        Me.ComboBoxDayViewWarehouse.Items.Clear()

        Me.ComboBoxDayViewWarehouse.Items.Add("Select...")
        For Each warehouse As dbiWSF.FrameworkObjects.objWarehouse In myWSFObjects.Warehouses
            Me.ComboBoxDayViewWarehouse.Items.Add(warehouse.Description)
        Next

        'Set the combo box to display Select ...
        Me.ComboBoxDayViewWarehouse.SelectedIndex = 0

        Me.ComboBoxDayViewCargoTypeFilter.Items.Clear()

        Me.ComboBoxDayViewCargoTypeFilter.Items.Add("Select...")
        For Each cargotype As dbiWSF.FrameworkObjects.objCargoType In myWSFObjects.CargoTypes.Values
            Me.ComboBoxDayViewCargoTypeFilter.Items.Add(cargotype.Description)
        Next

        'Set the combo box to display Select ...
        Me.ComboBoxDayViewCargoTypeFilter.SelectedIndex = 0

        Me.ComboBoxDayViewLoadingDock.Items.Clear()

        Me.ComboBoxDayViewLoadingDock.Items.Add(New cbxItem("Select...", Nothing))
        For Each warehouse As dbiWSF.FrameworkObjects.objWarehouse In myWSFObjects.Warehouses
            Me.ComboBoxDayViewLoadingDock.Items.Add(New cbxItem(warehouse.Description, Nothing))
            For Each LoadingDock As dbiWSF.FrameworkObjects.objLoadingDock In warehouse.LoadingDocks
                Me.ComboBoxDayViewLoadingDock.Items.Add(New cbxItem(LoadingDock.Description, LoadingDock))
            Next
        Next

        'Set the combo box to display Select ...
        Me.ComboBoxDayViewLoadingDock.SelectedIndex = 0

    End Sub

    Private Sub SetdbiDayViewSettings()
        'This method populates the dbiWSFDayView control with the criteria selected by the user in the ExplorerBar.
        'NOTE: Several LINQ queries are used to determine the exact object(s) that fit the criteria selected 
        '      by the user and passes them to the various Set methods on the control to load it with the data.

        'This LINQ statement is used to build a collection of type dbiWSF.FrameworkObjects.objWarehouse based
        'on the selection of the user in a drop down list.
        Dim WarehouseCollection = From warehouses As dbiWSF.FrameworkObjects.objWarehouse In myWSFObjects.Warehouses _
                                  Where warehouses.Description = Me.ComboBoxDayViewWarehouse.Text _
                                  Select warehouses

        If WarehouseCollection.Count > 0 Then
            'A warehouse was selected in the drop down.

            Me.dbiWSFDayView1.Visible = True
            'This LINQ statement is used to build a collection of type dbiWSF.FrameworkObjects.objCargoType, based on the selection of the user
            'in a drop down list.
            Dim CargoCollection = From CargoTypes As dbiWSF.FrameworkObjects.objCargoType In myWSFObjects.CargoTypes.Values _
                                  Where CargoTypes.Description = Me.ComboBoxDayViewCargoTypeFilter.Text _
                                  Select CargoTypes


            'The SetWarehouseDetails method on the dbiWSFDayView control is used to set the control to display all the loading docks 
            'from one or more warehouses, on a given date.  The display can then be filtered to only show loadingdocks on the warehouse(s) 
            'that can receive a specific Cargo Type.
            Me.dbiWSFDayView1.SetWarehouseDetails(myWSFObjects, WarehouseCollection.ToList, Me.dbiWSFDayView1.DbiDayView1.Date, _
                                                  CargoCollection.ToList, myBusinessRules)

        Else
            'A warehouse was not selected in the drop down.

            If Me.ComboBoxDayViewLoadingDock.Items.Count > 0 Then
                'A loading dock was selected in the drop down.

                If Me.ComboBoxDayViewLoadingDock.SelectedItem.ObjData IsNot Nothing Then
                    Me.dbiWSFDayView1.Visible = True

                    'The SetLoadingDockDetails method on the dbiWSFDayView control is used to set the control to display a single 
                    'loading dock, either for a single day, span of days, or a collection of non-congruent dates.
                    Me.dbiWSFDayView1.SetLoadingDockDetails(myWSFObjects, Me.ComboBoxDayViewLoadingDock.SelectedItem.ObjData, _
                                                            Me.dbiWSFDayView1.DbiDayView1.Date, Me.dbiWSFDayView1.DbiDayView1.Date, _
                                                            myBusinessRules)
                Else

                    'No criteria have been set for the filter.
                    Me.dbiWSFDayView1.Visible = False

                End If

            End If

        End If
        'Scroll the day view control to begin displaying at 8:00 am.
        Me.dbiWSFDayView1.DbiDayView1.VertScrollValue = 16

    End Sub

    Private Sub dbiDayView1_clShipmentDoubleClick(ByVal sender As Object, ByVal e As dbiWSF.ControlLibrary.dbiWSFDayView.DayViewArgs) Handles dbiWSFDayView1.clShipmentDoubleClick
        'This event is fired when an appointment (shipment) receives a double click.
        'Present the user with a detail dialog containing the details for the shipment.
        Dim frmShipDetails As New ShipmentDetails(e.argShipment)
        frmShipDetails.ShowDialog(Me)

        'Update the data in the day view control with the changes from the detail dialog.
        Me.dbiWSFDayView1.DataRefresh()

    End Sub

    Private Sub NumericUpDownDayViewDisplayColumns_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDownDayViewDisplayColumns.ValueChanged
        'Set the number of columns to display in the day view control in response to a change in the NumericUpDown control in the ExplorerBar.

        Me.dbiWSFDayView1.DbiDayView1.DisplayColumns = CInt(Me.NumericUpDownDayViewDisplayColumns.Value)

    End Sub

    Private Sub LinkLabelDayViewProps_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabelDayViewProps.LinkClicked
        'Display a property grid form to allow the user to edit the properties of the day view control.
        Dim propFrm As New PropertyForm
        propFrm.PropertyGrid1.SelectedObject = dbiWSFDayView1
        propFrm.ShowDialog(Me)
        propFrm.Dispose()

    End Sub

#End Region

#Region "ExplorerBar routines"
    ''' <summary>The routines that govern the user interraction with the ExplorerBar control in the left hand panel of the split container.</summary>
    Private Sub DbiExplorerBar1_ItemClick(ByVal sender As System.Object, ByVal e As Dbi.WinControl.ExplorerBar.ItemClickEventArgs) Handles DbiExplorerBar1.ItemClick
        'This event is fired when one of the list items in the explorer bar is opened.
        'Determine which control will be hosted by the right panel in the application and display it for user interraction.

        If Me.DbiExplorerBar1.Lists(e.ListIndex).State = Dbi.WinControl.ExplorerBar.dbiExplorerList.enumState.Opened Then
            'Toggle the list closed
            HideExplorerLists(e.ListIndex)

        End If

        Select Case e.ListIndex
            Case 0 'Main
                'Display the Home Page WPF user control.

                'Remove any controls from the right hand panel in the split control.
                Me.SplitContainer.Panel2.Controls.Clear()

                'Create a new instance of the Home Page WPF User Control.
                Dim welcomeScreen1 As New WSSHomeUC
                MyWelcomeScreen.Child = Nothing

                'Size the Home Page container to the size of the WPF User Control.
                MyWelcomeScreen.Child = welcomeScreen1
                MyWelcomeScreen.Size = New Size(welcomeScreen1.MinWidth, welcomeScreen1.MinHeight)

                'Center the home page in the available area in the right hand panel of the split control.
                AlignWelcomescreen()

                Me.SplitContainer.Panel2.BackColor = Color.White
                MyWelcomeScreen.BackColor = Color.Transparent

                'Add the Home Page to the right hand panel of the split control.
                Me.SplitContainer.Panel2.Controls.Add(MyWelcomeScreen)

                'Load the data for the welcome screen.
                welcomeScreen1.LoadData(StartDate)

            Case 1 'Schedule
                If Me.DbiExplorerListSchedule.State = Dbi.WinControl.ExplorerBar.dbiExplorerList.enumState.Opened Then

                    'Display the dbiWSFSchedule user control.

                    'Remove any controls from the right hand side of the split control.
                    Me.SplitContainer.Panel2.Controls.Clear()

                    'Add the context menu to the dbiSchedule control.
                    Me.dbiWSFSchedule1.dbiSchedContextMenu = myContextMenu

                    'Set the dbiSchedule control to fill the panel.
                    dbiWSFSchedule1.Dock = DockStyle.Fill

                    'NOTE: The SetMainObjects method is used to populate the dbiWSFSchedule with all of the objects loaded from your data.
                    '      This method will auto create all of the items in the schedule's list, as well as all the TimeBars and CustomAreas.
                    '      The default call of this method, will create a schedule starting at the current date Today, and spanning 7 days forward.
                    '           dbiWSFSchedule1.SetMainObjects(myWSFObjects, myBusinessRules, StartDate, EndDate)
                    '      The SetMainObjects method can also be called with optional date parameters, which will set the start and end dates of your
                    '      schedule to your specified values.

                    'Load the dbiWSFSchedule control with the objects for one week starting on January 2, 2012.
                    dbiWSFSchedule1.SetMainObjects(myWSFObjects, myBusinessRules, StartDate, EndDate)

                    'Prevent the programmatic changing of the date in the dbiDateTime control to fire the date changed event
                    'by removing the event handler.
                    RemoveHandler Me.DbiDateTimeSchedStart.DateChanged, AddressOf Me.DbiDateTimeSchedStart_DateChanged
                    'Set the start date to the start date of the schedule object loaded in the dbiSchedule control.
                    Me.DbiDateTimeSchedStart.Date = Me.dbiWSFSchedule1.dbiScheduleMain.Schedules(0).Start
                    'Reenable the DateChanged event handler by using the AddHandler method.
                    AddHandler Me.DbiDateTimeSchedStart.DateChanged, AddressOf Me.DbiDateTimeSchedStart_DateChanged

                    'Configure the alternating colors as per the selected style.
                    UseAltColors()

                    'Scroll the dbiSchedule control to start displaying at 8:00 am.
                    dbiWSFSchedule1.dbiScheduleMain.ScrollToDateTime(StartDate.AddHours(8), 0)

                    'Expand the parent nodes (Warehouses) in the list to display the child nodes (Loading Docks).
                    For Each curWarehouse As Dbi.WinControl.Schedule.dbiScheduleItem In Me.dbiWSFSchedule1.dbiScheduleMain.Items
                        curWarehouse.ExpandAll()
                    Next

                    'Add the schedule control to the split container panel 2 (right hand side of split control).
                    Me.SplitContainer.Panel2.Controls.Add(dbiWSFSchedule1)

                    'Set the schedule detail control to dock in the top of the split container.
                    SchedDetail.Dock = DockStyle.Top
                    'Add the schedule detail control to the right hand side panel in the split container.
                    Me.SplitContainer.Panel2.Controls.Add(SchedDetail)

                    'Default the schedule to display one day.
                    Me.RadioButtonDays1.Checked = True

                End If

            Case 2 'DayView
                If Me.DbiExplorerListDayView.State = Dbi.WinControl.ExplorerBar.dbiExplorerList.enumState.Opened Then

                    'Display the dbiWSFDayView user control in the right hand panel of the split control.

                    'Set the day view control to start displaying on January 2, 2012.
                    Me.dbiWSFDayView1.DbiDayView1.Date = StartDate

                    'Scroll the day view control to start displaying at 8:00 am.
                    Me.dbiWSFDayView1.DbiDayView1.VertScrollValue = 16

                    'Populate the combo boxes with the criteria used to populate the day view control
                    PopulateDayViewComboBoxes()

                    'Me.DbiExplorerListSchedule.State = Dbi.WinControl.ExplorerBar.dbiExplorerList.enumState.Closed

                    'Set the day view control to fill the right side panel of the split control.
                    dbiWSFDayView1.Dock = DockStyle.Fill

                    'Clear all controls from the right hand panel in the split control.
                    Me.SplitContainer.Panel2.Controls.Clear()

                    'NOTE:  The SetdbiDayViewSettings method is called to populate the dbiWSFDayView control with the 
                    '       options selected by the user from the control's combo boxes.

                    'Default the day view to display all the loading docks from the first warehouse in the list.
                    Me.ComboBoxDayViewWarehouse.SelectedIndex = 1

                    'Default the control to display three columns (loading docks) from the selected warehouse.
                    Me.NumericUpDownDayViewDisplayColumns.Value = 3

                    'Populate the day view control based on the combo box values.
                    SetdbiDayViewSettings()

                    'Attach the context menu to the day view control.
                    Me.dbiWSFDayView1.dbiDayViewContextMenu = myContextMenu

                    'Set the day view detail created in the Global Controls (above) to dock at the top of the right hand panel in the split control.
                    DayViewDetail.Dock = DockStyle.Top

                    'Add the Day View control and Detail (explanation of the day view control) to the right hand panel in the split control.
                    Me.SplitContainer.Panel2.Controls.Add(dbiWSFDayView1)
                    Me.SplitContainer.Panel2.Controls.Add(DayViewDetail)

                End If

            Case 3 'Reports
                If Me.DbiExplorerListReports.State = Dbi.WinControl.ExplorerBar.dbiExplorerList.enumState.Opened Then

                    'Set the report user control to fill the right hand panel of the split control.
                    dbiReportObject1.Dock = DockStyle.Fill

                    'Remove all controls from the right hand panel in the split container
                    Me.SplitContainer.Panel2.Controls.Clear()

                    Select Case e.ItemIndex
                        'Determine which report has been selected.
                        'NOTE:  The Framework ships with three built in reports to illustrate how the reporting functionality is implemented.
                        '       reportDailyShipmentsByWarehouse
                        '       reportDailySignInSheet
                        '       reportProjectedInboundShipments

                        Case 0  'Daily Shipments By Warehouse
                            'Me.SplitContainer.Panel2.Controls.Clear()

                            'Create a new instance of the report passing all the loaded objects
                            Dim Report1 As New dbiWSF.UserInterface.dbiWSFReporting.reportDailyShipmentsByWarehouse(myWSFObjects)

                            'Set the start date of the report.
                            Report1.reportStart = StartDate

                            'Trigger the reports GenerateReport method, causing it to create all the details and structure of the report.
                            Report1.generateReport()

                            'Use the LoadReport method on the dbiReportObject user control, passing the previously
                            'generated report.  The reporting object handles the display and user interraction.
                            dbiReportObject1.loadReport(Report1)

                            'Add the report object to the right hand panel in the split control.
                            Me.SplitContainer.Panel2.Controls.Add(dbiReportObject1)

                        Case 1  'Daily Sign In Sheet
                            'Me.SplitContainer.Panel2.Controls.Clear()

                            'Create a new instance of the report passing all the loaded objects
                            Dim Report1 As New dbiWSF.UserInterface.dbiWSFReporting.reportDailySignInSheet(myWSFObjects)

                            'NOTE: The Daily Sign In Sheet requires a warehouse to filter the data when preparing the report.
                            'Default the report to show the first warehouse in the list.
                            Report1.Criteria = myWSFObjects.Warehouses(0).WarehouseID.ToString

                            'Set the start date of the report.
                            Report1.reportStart = StartDate

                            'Trigger the reports GenerateReport method, causing it to create all the details and structure of the report.
                            Report1.generateReport()

                            'Use the LoadReport method on the dbiReportObject user control, passing the previously
                            'generated report.  The reporting object handles the display and user interraction.
                            dbiReportObject1.loadReport(Report1)

                            'Add the report object to the right hand panel in the split control.
                            Me.SplitContainer.Panel2.Controls.Add(dbiReportObject1)

                        Case 2  'Projected Inbound Shipments
                            'Me.SplitContainer.Panel2.Controls.Clear()

                            'Create a new instance of the report passing all the loaded objects
                            Dim Report1 As New dbiWSF.UserInterface.dbiWSFReporting.reportProjectedInboundShipments(myWSFObjects)

                            'Set the start date of the report.
                            'NOTE:  Unlike the previous 2 reports, this one is not restricted to a single date, as such it requires 
                            '       a DateEnd parameter.
                            Report1.reportStart = StartDate

                            'Set the report to include all the dates in the week.
                            Report1.reportEnd = EndDate

                            'Trigger the reports GenerateReport method, causing it to create all the details and structure of the report.
                            Report1.generateReport()

                            'Use the LoadReport method on the dbiReportObject user control, passing the previously
                            'generated report.  The reporting object handles the display and user interraction.
                            dbiReportObject1.loadReport(Report1)
                            Dim ReportCriteria As New ReportCriteriaDates(Report1, dbiReportObject1)

                            ReportCriteria.Dock = DockStyle.Top
                            ReportCriteria.DbiDropDateReportStart.Date = Report1.reportStart
                            ReportCriteria.DbiDropDateReportEnd.Date = Report1.reportEnd

                            'Add the report object to the right hand panel in the split control.
                            Me.SplitContainer.Panel2.Controls.Add(dbiReportObject1)
                            Me.SplitContainer.Panel2.Controls.Add(ReportCriteria)

                    End Select

                End If

            Case 4 'Exception Maintenance
                Select Case e.ItemIndex

                    Case 0

                        'Remove any controls from the right hand panel in the split control.
                        Me.SplitContainer.Panel2.Controls.Clear()

                        'Set the ExceptionMaintenanceControl User Control to display all currently created LoadingDockExceptions
                        ExceptionMaintenance.SetForm(ExceptionMaintenanceControl.MaintenanceType.DockException)

                        'Set the form to fill the right hand panel in the split control.
                        ExceptionMaintenance.Dock = DockStyle.Fill

                        'Set the Exception Detail (Explanation of the Exceptions) to dock at the top of the right hand panel in the split control.
                        ExceptionDetail.Dock = DockStyle.Top

                        'Add the two controls to the right hand panel in the split control.
                        Me.SplitContainer.Panel2.Controls.Add(ExceptionMaintenance)
                        Me.SplitContainer.Panel2.Controls.Add(ExceptionDetail)

                    Case 1

                        'Remove any controls from the right hand panel in the split control.
                        Me.SplitContainer.Panel2.Controls.Clear()

                        'Set the ExceptionMaintenanceControl User Control to display all currently created Recurring LoadingDockExceptions
                        ExceptionMaintenance.SetForm(ExceptionMaintenanceControl.MaintenanceType.RecurrenceDockException)

                        'Set the form to fill the right hand panel in the split control.
                        ExceptionMaintenance.Dock = DockStyle.Fill

                        'Set the Exception Detail (Explanation of the Exceptions) to dock at the top of the right hand panel in the split control.
                        ExceptionDetail.Dock = DockStyle.Top

                        'Add the two controls to the right hand panel in the split control.
                        Me.SplitContainer.Panel2.Controls.Add(ExceptionMaintenance)
                        Me.SplitContainer.Panel2.Controls.Add(ExceptionDetail)

                End Select

                If ExceptionMaintenance.DbiList1.Items.Count > 0 Then

                    'Preset the control to display the first item in the Exceptions list.

                    Dim newE As New Dbi.WinControl.NodeClickEventArgs
                    newE.Item = ExceptionMaintenance.DbiList1.Items(0)
                    newE.Button = Windows.Forms.MouseButtons.Left

                    'Invoke the node click event on the list to simulate the user selecting the first item in the list.
                    ExceptionMaintenance.DbiList1_NodeClick(Me, newE)

                End If

        End Select

    End Sub

    Private Sub HideExplorerLists(ByVal curIndex As Integer)
        'This method toggles the state of the lists inside the dbiExplorerBar, to ensure that only one can ever be expanded
        'at one time.

        'Iterate through the lists in the explorer referencing their index value.
        For curList As Integer = 0 To Me.DbiExplorerBar1.Lists.Count - 1

            If curList <> curIndex Then

                Me.DbiExplorerBar1.Lists(curList).State = Dbi.WinControl.ExplorerBar.dbiExplorerList.enumState.Closed

            End If

        Next

        'Reset the controls hosted in the explorer bar.
        TogglePanelValues()

        'Clear any controls in the right hand panel of the split container.
        Me.SplitContainer.Panel2.Controls.Clear()

    End Sub

    Private Sub TogglePanelValues()
        'Reset the values of any controls related to the panels in the dbiExplorerBarLists

        'Radio buttons on the dbiWSFSchedule Panel
        Me.RadioButtonDays1.Checked = False
        Me.RadioButtonDays5.Checked = False
        Me.RadioButtonDays7.Checked = False

        'Combo boxes and numeric up/down on the dbiWSFDayView Panel
        Me.ComboBoxDayViewCargoTypeFilter.Items.Clear()
        Me.ComboBoxDayViewLoadingDock.Items.Clear()
        Me.ComboBoxDayViewWarehouse.Items.Clear()
        Me.NumericUpDownDayViewDisplayColumns.Value = 1

        'Clear the object detail control on the Exception Maintenance form
        Me.ExceptionMaintenance.ClearForm()

    End Sub

#End Region

    Private Sub MovieToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WSFOverviewToolStripMenuItem.Click, BusinessRulesToolStripMenuItem.Click, DataBindingToolStripMenuItem.Click, IntegratingWSFToolStripMenuItem.Click, ReportingToolStripMenuItem.Click, UserInterfaceToolStripMenuItem.Click, UserInterfaceToolStripMenuItem.Click, WSFObjectsToolStripMenuItem.Click
        Dim movieList As New DBIMedia.DBIMediaPlayer.PlayList

        Select Case sender.ToString

            Case "WSF Overview"
                Dim movie1 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie1.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/Intro01.01.00Final.wmv")
                movie1.movieDescription = "WSF - Introduction"
                movieList.AddMovie(movie1)

                Dim movie2 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie2.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/dbiWSFIntro02.01.00Final.wmv")
                movie2.movieDescription = "Why Use the WSF"
                movieList.AddMovie(movie2)

                Dim movie3 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie3.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/dbiWSFIntro02.02.00Final.wmv")
                movie3.movieDescription = "Why you NEED the WSF"
                movieList.AddMovie(movie3)

                Dim movie4 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie4.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/dbiWSFIntro02.03.00Final.wmv")
                movie4.movieDescription = "What comes in the package"
                movieList.AddMovie(movie4)

                Dim movie5 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie5.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/dbiWSFIntro02.04.00Final.wmv")
                movie5.movieDescription = "Basics of Warehouse Shipments Scheduling"
                movieList.AddMovie(movie5)


            Case "Data Binding"
                Dim movie31 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie31.movieDescription = "Database Connections and Types"
                movie31.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/Databinding03.01.00Final.wmv")
                movieList.AddMovie(movie31)

                Dim movie32 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie32.movieDescription = "Using the core databases"
                movie32.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/Databinding03.02.00Final.wmv")
                movieList.AddMovie(movie32)

                Dim movie33 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie33.movieDescription = "Modifying the core databases"
                movie33.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/Databinding03.03.00Final.wmv")
                movieList.AddMovie(movie33)

                Dim movie34 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie34.movieDescription = "Incorporating external databases"
                movie34.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/Databinding03.04.00Final.wmv")
                movieList.AddMovie(movie34)

                Dim movie35 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie35.movieDescription = "Modifying core database CRUD operations"
                movie35.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/Databinding03.05.00Final.wmv")
                movieList.AddMovie(movie35)

                Dim movie36 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie36.movieDescription = "Using the Customized databinding type"
                movie36.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/Databinding03.06.00Final.wmv")
                movieList.AddMovie(movie36)

                Dim movie37 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie37.movieDescription = "Using the CMAP column mapping"
                movie37.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/Databinding03.07.00Final.wmv")
                movieList.AddMovie(movie37)

                Dim movie38 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie38.movieDescription = "The AutoUpdate property and functionality "
                movie38.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/Databinding03.08.00Final.wmv")
                movieList.AddMovie(movie38)

                Dim movie39 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie39.movieDescription = "Using the Load Methods in the databinding class"
                movie39.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/Databinding03.09.00Final.wmv")
                movieList.AddMovie(movie39)

            Case "WSF Objects"
                Dim movie41 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie41.movieDescription = "The dbiWSF Framework Objects"
                movie41.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/dbiWSFObjects04.01.00Final.wmv")
                movieList.AddMovie(movie41)

                Dim movie42 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie42.movieDescription = "Default property Constants"
                movie42.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/dbiWSFObjects04.02.00Final.wmv")
                movieList.AddMovie(movie42)

                Dim movie43 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie43.movieDescription = "Using GET methods for the GUIDs"
                movie43.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/dbiWSFObjects04.03.00Final.wmv")
                movieList.AddMovie(movie43)

                Dim movie44 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie44.movieDescription = "Using object remove methods and overloads"
                movie44.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/dbiWSFObjects04.04.00Final.wmv")
                movieList.AddMovie(movie44)

            Case "Business Rules"
                Dim movie51 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie51.movieDescription = "The Business Rules Overview"
                movie51.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/BusinessRules05.01.00Final.wmv")
                movieList.AddMovie(movie51)

                Dim movie52 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie52.movieDescription = "Business Rules Setup"
                movie52.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/BusinessRules05.02.00Final.wmv")
                movieList.AddMovie(movie52)

                Dim movie53 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie53.movieDescription = "Business Rules uses Reflection"
                movie53.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/BusinessRules05.03.00Final.wmv")
                movieList.AddMovie(movie53)

                Dim movie54 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie54.movieDescription = "Business Rules with extra parameters"
                movie54.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/BusinessRules05.04.00Final.wmv")
                movieList.AddMovie(movie54)

            Case "Reporting"
                Dim movie61 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie61.movieDescription = "Reporting Control"
                movie61.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/Reporting06.01.00Final.wmv")
                movieList.AddMovie(movie61)

                Dim movie62 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie62.movieDescription = "Setting up a Custom Report using the Template"
                movie62.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/Reporting06.02.00Final.wmv")
                movieList.AddMovie(movie62)

                Dim movie63 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie63.movieDescription = "Integrating a Report Object with the Report Control"
                movie63.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/Reporting06.03.00Final.wmv")
                movieList.AddMovie(movie63)

            Case "User Interface"
                Dim movie71 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie71.movieDescription = "User Interface Introduction"
                movie71.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UserInterface07.01.00Final.wmv")
                movieList.AddMovie(movie71)

                Dim movie72 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie72.movieDescription = "User Interface - Shipments Schedule Control"
                movie72.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UserInterface07.02.00Final.wmv")
                movieList.AddMovie(movie72)

                Dim movie73 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie73.movieDescription = "User Interface - Shipments Day View Control"
                movie73.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UserInterface07.03.00Final.wmv")
                movieList.AddMovie(movie73)

                Dim movie74 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie74.movieDescription = "User Interface - Object Menu Control"
                movie74.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UserInterface07.04.00Final.wmv")
                movieList.AddMovie(movie74)

                Dim movie75 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie75.movieDescription = "User Interface - Reporting Control"
                movie75.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UserInterface07.05.00Final.wmv")
                movieList.AddMovie(movie75)

                Dim movie76 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie76.movieDescription = "User Interface - Styling Controls"
                movie76.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UserInterface07.06.00Final.wmv")
                movieList.AddMovie(movie76)

                Dim movie77 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie77.movieDescription = "User Interface - Supporting Controls"
                movie77.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UserInterface07.07.00Final.wmv")
                movieList.AddMovie(movie77)

                Dim movie78 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie78.movieDescription = "User Interface - Interface Dialogs"
                movie78.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UserInterface07.08.00Final.wmv")
                movieList.AddMovie(movie78)

            Case "Integrating WSF"
                Dim movie81 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie81.movieDescription = "Project Template"
                movie81.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UsingWSF08.01.00Final.wmv")
                movieList.AddMovie(movie81)

                Dim movie82 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie82.movieDescription = "Class Layout Template"
                movie82.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UsingWSF08.02.00Final.wmv")
                movieList.AddMovie(movie82)

                Dim movie83 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie83.movieDescription = "<Generic Error> Exceptions"
                movie83.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UsingWSF08.03.00Final.wmv")
                movieList.AddMovie(movie83)

                Dim movie84 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie84.movieDescription = "LINQ and Strongly Typed Objects"
                movie84.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UsingWSF08.04.00Final.wmv")
                movieList.AddMovie(movie84)

                Dim movie85 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie85.movieDescription = "Cargo Types and Breakout Docks"
                movie85.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UsingWSF08.05.00Final.wmv")
                movieList.AddMovie(movie85)

                Dim movie86 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie86.movieDescription = "External Data"
                movie86.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UsingWSF08.06.00Final.wmv")
                movieList.AddMovie(movie86)

                Dim movie87 As New DBIMedia.DBIMediaPlayer.Movie2Play
                movie87.movieDescription = "Using the Sample Application"
                movie87.movieURI = New Uri("http://www.dbi-tech.com/Frameworks/Movies/dbiWSF/UsingWSF08.07.00Final.wmv")
                movieList.AddMovie(movie87)

        End Select

        If movieList.movies2Play.Count > 0 Then

            Dim moviePlayer As New frmMediaViewer(movieList)
            moviePlayer.ShowDialog(Me)

        End If

    End Sub

End Class
